Skip to content

Highlight kebab-case Vue component tags#115

Open
lei233 wants to merge 1 commit intozed-extensions:mainfrom
lei233:fix-kebab-case-component-highlighting
Open

Highlight kebab-case Vue component tags#115
lei233 wants to merge 1 commit intozed-extensions:mainfrom
lei233:fix-kebab-case-component-highlighting

Conversation

@lei233
Copy link
Copy Markdown

@lei233 lei233 commented Mar 27, 2026

Summary

This updates Vue syntax highlighting so kebab-case component tags are highlighted as components.

Previously, only PascalCase tags matched the component rule, so tags like <my-component> fell back to regular tag highlighting.

Changes

  • keep plain lowercase HTML tags like <div> as regular tags
  • keep PascalCase tags like <MyComponent> highlighted as components
  • highlight kebab-case tags like <my-component> as components

Verification

Tested in Zed after reloading extensions with examples like:

<MyComponent />
<my-component />
<div />

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 27, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @lei233 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@lei233
Copy link
Copy Markdown
Author

lei233 commented Mar 27, 2026

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Mar 27, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 27, 2026

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Copy Markdown
Contributor

@icarusgk icarusgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can confirm this works as expected with PascalCase and kebab-case components.

Image

Copy link
Copy Markdown
Contributor

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

Overall looks good, but wondering whether we can by any chance not simplify the regexes a bit? I see that with your match, you prevent matching invalid identifiers, wondeirng whether we cannot perhaps still match them despite being invalid to simplify things a bit for the matching itself?

Also, while you are at it, could you remove the @tag and replace it with just the @tag.component.type.constructor in that query? That should make things a bit more efficient without losing any functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants